﻿using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lails.QuartzHelper.Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            //每天1点10分30秒触发任务，Cron语法，参见:https://yq.aliyun.com/articles/62723
            Quartz.QuartzHelper.ExecuteByCron<SampleTask>("30 10 1 * * ? ");
            //每30秒执行一次任务
            Quartz.QuartzHelper.ExecuteInterval<SampleTask>(30, context: "SampleTask");
        }
    }

    //public class DemoTask : IJob
    //{
    //    public void Execute(IJobExecutionContext context)
    //    {
    //        Console.WriteLine($"Working On {DateTime.Now}");
    //    }
    //}

    public class SampleTask : QuartzTask
    {
        public override void ExecuteTask(object context)
        {
            Console.WriteLine($"Working On {DateTime.Now}, Param: {context}");
        }
    }
}
